package scuts.core;

import scuts.core.types.LazyIterator;


class SizeArray
{
  public static function size<T>(arr:Array<T>):T
  {
    return arr.length;
  } 
}
 
class SizeIterable
{
  public static function size<T>(iter:Iterable<T>):T
  {
    return SizeIterator.size(iter.iterator());
  }
}

class SizeIterator
{
  public static function size<T>(iter:Iterator<T>):T
  {
    var s = 0;
    for (e in iter) {
      s++;
    }
    return s;
  } 
}

class SizeLazyIterator
{
  public static function size<T>(iter:LazyIterator<T>):T
  {
    return SizeIterator.size(iter());
  } 
}